package com.iflytek.cosmo.ocr.service;

import com.iflytek.cosmo.ocr.model.domain.MessageOutput;
import com.iflytek.cosmo.ocr.model.entity.LicenseEntity;
import com.iflytek.cosmo.ocr.model.entity.MacLicenseEntity;
import com.iflytek.cosmo.ocr.web.vo.AuthrizationVO;

import java.util.List;

/**
 * @author ViviZhou
 * @create 2019-12-12 17:16
 */
public interface AuthorizationService {
    /**
     * 根据mac或主板id查询授权码id
     * @param macOrMainBoardAdd
     * @return
     */
    List<MacLicenseEntity> findLicenseId(List<String> macOrMainBoardAdd);

    /**
     * 根据codeid，来查找授权码
     * @param codeIdList
     * @return
     */
    List<LicenseEntity> findLicense(List<String> codeIdList);

    /**
     * 生成授权码，并插入数据库中
     * @param type 授权码类型
     */
    String generateAuthorizationCode(String type);

    /**
     * 绑定授权码与与主板号
     * @param licenseId
     * @param motherBoardList
     */
    void bindLicenseAndMac(String licenseId, List<String> motherBoardList);

    /**
     * 根据一个mac查询codeid
     * @param mac
     * @return
     */
    String getCodeId(String mac);

    /**
     * 根据LicenseId查找LicenseEntity
     * @param id
     * @return
     */
    LicenseEntity findLicenseEntityById(String id);

    /**
     * 免授权模式处理方式
     * @param macIdArray
     * @param authrizationVO
     * @param motherBoardList
     * @param licenseEntity
     * @return
     */
    MessageOutput freeAuthorizationModel(String[] macIdArray, AuthrizationVO authrizationVO, List<String> motherBoardList, LicenseEntity licenseEntity);

    /**
     * 非免授权模式处理方式
     * @param licenseEntity
     * @return
     */
    MessageOutput noneFreeAuthorizationModel(LicenseEntity licenseEntity, AuthrizationVO authrizationVO);
}
